<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ProductAddEdit.ascx.cs" Inherits="IGlobalist.Cms.Admin.Control.ProductAddEdit" %>
<%@ Register Assembly="TinyMCE" Namespace="IGlobalist.Web.UI" TagPrefix="cc2" %>
<%@ Register Src="ResourceFileAddEdit.ascx" TagName="ResourceFileAddEdit" TagPrefix="uc3" %>
<%@ Register Src="ContentNoteList.ascx" TagName="ContentNoteList" TagPrefix="uc2" %>
<%@ Register Src="CmsExtPropertiesForm.ascx" TagName="CmsExtPropertiesForm" TagPrefix="uc1" %>
<%@ Register Src="CmsExtPropertiesForm.ascx" TagName="CmsExtPropertiesForm" TagPrefix="uc5" %>
<asp:Panel runat="server" ID="pnlProductAddEdit"  Width="80%">
<script>

function _JsProduct(){
    this.showPreview=function(el,containerID){
        var imgPreview=document.getElementById(containerID);
        var imageID=el.options[el.selectedIndex].value;
        imgPreview.src="../ImageView.aspx?id="+imageID+"&mdim=60";        
    };
    this.showThumnail=function(el,containerID){
        var imgThumnail=document.getElementById(containerID);
        var imageID=el.options[el.selectedIndex].value;
        imgThumnail.src="../ImageView.aspx?id="+imageID+"&mdim=60";        
    }
}

var JsProduct=new _JsProduct();

</script>
<table>
<tr>
    <td align="center">
        <asp:Label runat="server" ID="lblStatus" ForeColor="#1A5688" Font-Bold="True" Font-Size="Medium"/>
    </td>
</tr>
<tr>
    <td>
            <asp:ValidationSummary ID="ValidationSummary1" runat="server" ShowMessageBox="True" />
    </td>
</tr>
<tr>
    <td>
        <fieldset id="Fieldset2" runat="server">
             <legend><asp:Label ID="Label10"  runat="server"  Text="Product info" ></asp:Label> </legend>
    <table width="80%">
    <tr><td colspan="2">Version: 1</td></tr>
    <tr>
        <td>Product class </td>
        <td>
            <asp:DropDownList ID="ddlClass" runat="server"  Enabled="False" OnSelectedIndexChanged="ddlClassPage_SelectedIndexChanged" AutoPostBack="true" DataSourceID="ODSClassPage" DataTextField="Name" DataValueField="ID" >
            </asp:DropDownList>
            <asp:ObjectDataSource ID="ODSClassPage" runat="server" SelectMethod="GetClassListByClassTypeID"  TypeName="IGlobalist.Cms.Bll.ClassController">
                <SelectParameters>
                        <asp:Parameter DefaultValue="11" Name="classTypeID" Type="Int16" />
                </SelectParameters>
            </asp:ObjectDataSource>
        </td>
    </tr>
    <tr><td><asp:Label ID="Label1" runat="server" Text="Title"></asp:Label></td>
        <td style="width: 500px"><asp:TextBox ID="tbTitle" runat="server" ></asp:TextBox>
        <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="tbTitle"
                ErrorMessage="Require title" Display="Static" >*</asp:RequiredFieldValidator>
        </td>    
    </tr>
    <tr>
        <td valign="top"><asp:Label ID="Label7" runat="server" Text="Tags"></asp:Label></td>
        <td style="width: 500px"><asp:TextBox ID="tbtag" runat="server" Rows="4" Height="100px" TextMode="MultiLine" ></asp:TextBox></td>                       
    </tr>
    <tr>
        <td style="height: 65px"><asp:Label ID="Label8" runat="server" Text="Language"></asp:Label></td>
        <td style="width: 500px; height: 65px">
         <asp:DropDownList ID="ddlLanguage" runat="server" DataSourceID="XDSLanguage" DataTextField="name" DataValueField="value"></asp:DropDownList>
         <asp:XmlDataSource ID="XDSLanguage" runat="server" DataFile="~/Admin/XML/Language.xml"
        XPath="//languages/item"></asp:XmlDataSource>   
         </td>                       
    </tr>
    
     <tr>
        <td valign="top"><asp:Label ID="Label3" runat="server" Text="Summary"></asp:Label></td>
        <td style="width: 500px">
            <cc2:TinyMCE ID="tinyMCESummary" runat="server" Resize="false" Theme="Advanced" ToolbarLocation="Top" Height="300px"/>
        </td>                       
    </tr>  
    
     <tr>
        <td valign="top"><asp:Label ID="Label2" runat="server" Text="Content"></asp:Label></td>
        <td>
            <cc2:TinyMCE ID="tinyMCEContent" runat="server"  Theme="Advanced" Resize="false" ToolbarLocation="Top" Height="500px"/>
        </td>                       
    </tr> 

    <tr>
        <td style="height: 26px"><asp:Label ID="Label4" runat="server" Text="Seller"></asp:Label></td>
        <td style="width: 500px; height: 26px">
            <asp:TextBox ID="tbSaler" runat="server" ></asp:TextBox></td>                       
    </tr> 

    <tr>
        <td style="height: 26px">Price</td>
        <td style="width: 500px; height: 26px;">
            <asp:TextBox runat="server" ID="tbPrice" />
            <asp:RangeValidator ID="rvalidSale" runat="server" ControlToValidate="tbPrice" ErrorMessage="Price is number"
                Type="Integer" MaximumValue="100000" MinimumValue="0">*</asp:RangeValidator>
            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="tbPrice"
                ErrorMessage="Require price">*</asp:RequiredFieldValidator></td>                       
    </tr> 
    <tr>
        <td>Price Sales</td>
        <td style="width: 500px">
            <asp:TextBox runat="server" ID="tbPriceSale" />
            <asp:RangeValidator ID="rvalidPriceSale" runat="server" ControlToValidate="tbPriceSale"
                ErrorMessage="Price Sales is number" Type="Integer" MaximumValue="100000" MinimumValue="0">*</asp:RangeValidator>
            <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="tbPriceSale"
                ErrorMessage="Require price sales">*</asp:RequiredFieldValidator></td>                       
    </tr> 
    <tr>
        <td style="height: 26px">Discount</td>
        <td style="height: 26px">
            <asp:TextBox runat="server" ID="tbDiscount" />
            <asp:RangeValidator ID="rvDiscount" runat="server" ControlToValidate="tbDiscount"
                ErrorMessage="Discount is number" MaximumValue="100000" MinimumValue="0" Type="Integer">*</asp:RangeValidator>
                <asp:RequiredFieldValidator  ID="fvDiscount" runat="server" ControlToValidate="tbDiscount" ErrorMessage="Require Discount">*</asp:RequiredFieldValidator></td>
    </tr>
    <tr>
        <td>Code</td>
        <td><asp:TextBox runat="server" ID="tbCode" />   </td>
    </tr>
    <tr>
        <td><asp:Label ID="Label5" runat="server" Text="Image Thumnail"></asp:Label></td>
        <td style="width: 500px">
            <div>
            <asp:DropDownList runat="server" ID="ddlImageThumNail" Width="150px" />            
            <asp:Image runat="server"  ImageUrl="../Images/spacer.gif" ID="imgThumnail" />
            <asp:Button runat="server" ID="btnUploadImageThumnail"  CausesValidation="false" OnClick="btnUploadImageThumnail_Click" Text="Upload Image Thumnail" />
            </div>
        </td>
    </tr>
    <tr>
        <td><asp:Label ID="Label13" runat="server" Text="Image Preview"></asp:Label></td>
        <td style="width: 500px">
            <div>
            <asp:DropDownList runat="server" ID="ddlImagePreView" Width="150px" /> 
            <asp:Image runat="server"  ImageUrl="../Images/spacer.gif" ID="imgPreview" />
            <asp:Button runat="server" ID="btnUploadImagePreView" CausesValidation="false" OnClick="btnUploadImagePreView_Click" Text="Upload Image Preview" /></div>
        </td>
    </tr>
    <tr>
        <td><asp:Label ID="Label11" runat="server" Text="Page"></asp:Label></td>
        <td style="width: 500px"> 
         <asp:DropDownList ID="ddlPage" runat="server" DataTextField="Name" DataValueField="ID" DataSourceID="ODSPage"  >
                            
              </asp:DropDownList><asp:ObjectDataSource ID="ODSPage" runat="server" SelectMethod="GetPageListForBindTree"
             TypeName="IGlobalist.Cms.Bll.PageController">
             <SelectParameters>
                 <asp:Parameter DefaultValue="0" Name="classID" Type="Int64" />
                 <asp:Parameter DefaultValue="0" Name="currentID" Type="Int64" />
             </SelectParameters>
         </asp:ObjectDataSource>
            <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="ddlPage"
                ErrorMessage="Require Page" InitialValue="0">*</asp:RequiredFieldValidator>
            &nbsp;&nbsp;
         </td>                       
    </tr>
    
    <tr>
        <td><asp:Label ID="Label12" runat="server" Text="Category"></asp:Label></td>
        <td style="width: 500px">
         <asp:DropDownList ID="ddlCategory" runat="server" DataTextField="Name" DataValueField="ID" DataSourceID="ODSCategory"  >
                            
                            </asp:DropDownList><asp:ObjectDataSource ID="ODSCategory" runat="server" SelectMethod="GetCategoryTreeForBind"
             TypeName="IGlobalist.Cms.Bll.CategoryController">
             <SelectParameters>
                 <asp:Parameter DefaultValue="0" Name="currentCategoryID" Type="Int64" />
                 <asp:Parameter DefaultValue="0" Name="categoryID" Type="Int64" />
             </SelectParameters>
         </asp:ObjectDataSource>
            
         </td>                       
    </tr>
    </table>
    </fieldset>
    </td>
</tr>
<tr><td><table>
<tr><td > <fieldset id="fsExtenderProduct" runat="server"  visible="false">
     <legend><asp:Label ID="Label9"  runat="server"  Text="Ext Properties"></asp:Label> </legend>    
     <uc1:CmsExtPropertiesForm ID="ucCmsExtPropertiesForm2" runat="server" />
     </fieldset>
     </td></tr>
</table></td></tr>

</table>
<asp:HiddenField runat="server" ID="hdfClassID" Value="0" />
<asp:HiddenField runat="server" ID="hdfPageID" Value="0" />
<asp:HiddenField runat="server" ID="hdfCategoryID" Value="0" />
</asp:Panel>
<asp:Panel runat="server" ID="pnlUploadImage" Visible="false">
<fieldset id="fsMain" runat="server">
<legend><asp:Label ID="lblMainProperties"  runat="server"  Text="Main Properties"></asp:Label> </legend>
        
<table border="0">
    <tr>
        <td colspan="2" align="center" style="height: 21px">
            <b>UPLOAD FILE</b>
        </td>
    </tr>
    <tr>
        <td>File Class</td>
        <td><asp:DropDownList runat="server" ID="ddlClassFileList" /></td>        
    </tr>
    <tr>
        <td>File Type</td>
        <td>                
            <asp:DropDownList runat="server" ID="ddlImageType">
                    <asp:ListItem Selected="True" Text="Select a file type" Value="Select a file type" />         
                    <asp:ListItem  Text="Folder" Value="0"/>
                    <asp:ListItem  Text="Image" Value="1"/>
                    <asp:ListItem  Text="Audio" Value="2"/>
                    <asp:ListItem  Text="Video" Value="3"/>
                    <asp:ListItem  Text="Flash" Value="4"/>
                    <asp:ListItem  Text="Css" Value="5"/>
                    <asp:ListItem  Text="Script" Value="6"/>
                    <asp:ListItem  Text="Document" Value="7"/>
                    <asp:ListItem  Text="Others" Value="8"/>
            </asp:DropDownList>            
            <asp:RequiredFieldValidator id="rfvImageType" runat="server" ErrorMessage="Please make a selection" ControlToValidate="ddlImageType" InitialValue="Select a file type">*</asp:RequiredFieldValidator>            
            </td>
    </tr>            
    <tr>
        <td>File Name:</td>
        <td><asp:FileUpload runat="server" ID="fuFile"  Size="60"/> </td>
    </tr>     
    <tr>
        <td>Folder local</td>
        <td><asp:DropDownList runat="server" ID="ddlFolderList" /></td>
    </tr>  
    <tr>
        <td colspan="2" align="center" style="height: 26px"> 
            <asp:Button runat="server" ID="btnUpload" Text="Upload Image" OnClick="DoSaveFile" />
            <asp:Button runat="server" ID="btnCancel" Text="Cancel" OnClick="Cancel_event" />
        </td>        
    </tr>  
    <tr>
        <td colspan="2">
        <fieldset id="fsExtend" runat="server">
        <legend><asp:Label ID="lbMain"  runat="server"  Text="Ext Properties" Visible="False"></asp:Label> </legend>
            <uc5:CmsExtPropertiesForm ID="ucCmsExtPropertiesForm" runat="server" />
            
        </fieldset>
        </td>        
    </tr>
</table>
</fieldset>

</asp:Panel>
